Skip to content

Treat empty/comment-only YAML configs as empty list silently#71

Merged
daniel-thom merged 1 commit into
mainfrom
fix/yaml-empty-config-warning
May 10, 2026
Merged

Treat empty/comment-only YAML configs as empty list silently#71
daniel-thom merged 1 commit into
mainfrom
fix/yaml-empty-config-warning

Conversation

@daniel-thom
Copy link
Copy Markdown
Contributor

Summary

  • yaml.safe_load returns None for files containing only comments — which is exactly what datasight generate writes for time_series.yaml when no timestamp candidates are detected (data_profile.py:1641-1649).
  • The list-shape check at config.py:439 then logged WARNING | datasight.config - Expected a list in .../time_series.yaml, got NoneType on every load. Hit on every datasight ask after a generate.
  • Treat data is None as an empty list (silent) at all five list-loader sites: queries.yaml, measures.yaml, time_series.yaml, joins.yaml in config.py, plus validation.yaml in validation.py. Keep warning for genuinely wrong shapes like a top-level mapping.

Test plan

  • New test_load_time_series_config_comment_only_is_silent reproduces the user's exact scenario and asserts the warning is not emitted.
  • Tightened existing test_load_time_series_config_non_list to assert the warning is still emitted for the wrong-shape case (foo: bar at the top level).
  • pytest tests/test_config_extra.py tests/test_config.py — 45 passed.
  • prek run --all-files — clean.

🤖 Generated with Claude Code

yaml.safe_load returns None for files containing only comments — which
is exactly what `datasight generate` writes for time_series.yaml when
no timestamp candidates are detected. The list-shape check was then
warning on every load. Treat None as an empty list (silent) at all five
list-loader sites; keep warning for genuinely wrong shapes like a
top-level mapping.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.84%. Comparing base (69bbbeb) to head (780486c).

Files with missing lines Patch % Lines
src/datasight/config.py 62.50% 3 Missing ⚠️
src/datasight/validation.py 50.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (60.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
- Coverage   86.86%   86.84%   -0.03%     
==========================================
  Files          61       61              
  Lines       11552    11562      +10     
==========================================
+ Hits        10035    10041       +6     
- Misses       1517     1521       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daniel-thom daniel-thom merged commit 3a22f8a into main May 10, 2026
7 of 8 checks passed
@daniel-thom daniel-thom deleted the fix/yaml-empty-config-warning branch May 10, 2026 20:05
github-actions Bot pushed a commit that referenced this pull request May 10, 2026
Treat empty/comment-only YAML configs as empty list silently
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant